import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);

const router = new VueRouter({
  routes: [
    // 重定向到首页
    { path: "/", redirect: "home" },
    // 首页
    {
      path: "/home",
      component: () => import("../pages/home"),
      meta: { footer: true, header: false },
    },
    // 详情
    {
      path: "/detail/:id",
      component: () => import("../pages/detail"),
      meta: { footer: false, header: false },
    },

    // 收货地址
    {
      path: "/address",
      component: () => import("../pages/address"),
      meta: { footer: false, header: false },
    },
    {
      path: "/location",
      component: () => import("../pages/location"),
      meta: { footer: false, header: false },
    },
    // 购物车
    {
      path: "/cart",
      component: () => import("../pages/cart"),
      meta: { footer: true, header: false },
    },
    // 订单
    {
      path: "/order",
      component: () => import("../pages/order"),
      meta: { footer: false, header: true },
    },
    // 我的
    {
      path: "/mine",
      component: () => import("../pages/user/mine"),
      meta: { footer: true, header: false },
    },
    // 登录
    {
      path: "/register",
      component: () => import("../pages/user/register"),
      meta: { footer: false, header: true },
    },
    // 注册
    {
      path: "/login",
      component: () => import("../pages/user/login"),
      meta: { footer: false, header: true },
    },
    //修改个人信息
    {
      path: "/changeuser",
      component: () => import("../pages/user/changeuser"),
      meta: { footer: false, header: true },
    },
  ],
  mode: "history",
  linkActiveClass: "active",
});
export default router;
